/**
 * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
 */
package com.jeeplus.modules.guide.web;

import com.jeeplus.common.json.AjaxJson;
import com.jeeplus.common.utils.CacheUtils;
import com.jeeplus.common.utils.DateUtils;
import com.jeeplus.common.utils.StringUtils;
import com.jeeplus.common.utils.number.RandomUtil;
import com.jeeplus.common.web.Result;
import com.jeeplus.config.properties.JeePlusProperites;
import com.jeeplus.core.web.BaseController;
import com.jeeplus.modules.guide.entity.*;
import com.jeeplus.modules.guide.model.query.CancelAppointment;
import com.jeeplus.modules.guide.model.query.ModAppointment;
import com.jeeplus.modules.guide.model.vo.AppointmentRecordOut;
import com.jeeplus.modules.guide.model.vo.ModAppointmentOut;
import com.jeeplus.modules.guide.service.*;
import com.jeeplus.modules.guide.task.Send;
import com.jeeplus.modules.guide.utils.DistanceUtils;
import com.jeeplus.modules.guide.utils.HttpQueueUtils;
import com.jeeplus.modules.guide.utils.HttpRequestUtil;
import com.jeeplus.modules.sys.entity.MobileGxUser;
import com.jeeplus.modules.sys.entity.MobileUserQR;
import com.jeeplus.modules.sys.entity.User;
import com.jeeplus.modules.sys.security.util.JWTUtil;
import com.jeeplus.modules.sys.service.UserService;
import com.jeeplus.modules.sys.utils.EncryptUtils;
import com.jeeplus.modules.sys.utils.FileKit;
import com.jeeplus.modules.sys.utils.UserUtils;
import com.jeeplus.modules.work.queue.service.ElectronicMaterialService;
import lombok.RequiredArgsConstructor;
import net.sf.json.JSONObject;
import org.apache.commons.collections.map.HashedMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLDecoder;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;

/**
 * 高新分站点Controller
 * @author azj
 * @version 2021-5-15
 */
@RestController
@RequestMapping("/gxFZD")
@RequiredArgsConstructor
public class MobileFZDController extends BaseController {
	private static final Logger log = LoggerFactory.getLogger(MobileFZDController.class);
    private final MobileFZDService mobileFZDService;
	private final GXStreetsInfoService gxStreetsInfoService;


	/**
	 * 获取新闻内容
	 *
	 * @return
	 */
	@CrossOrigin(origins = "*")
	@PostMapping("getFZDNews")
	public AjaxJson getFZDNews(){
		return AjaxJson.success().put("data",mobileFZDService.getFZDNews()).put("url",mobileFZDService.getFZDMore());
	}

	/**
	 * 获取新闻内容
	 *
	 * @return
	 */
	@CrossOrigin(origins = "*")
	@PostMapping("getFZDView")
	public AjaxJson getFZDView(){
		return AjaxJson.success().put("data",mobileFZDService.getFZDView());
	}

	/**
	 * 获取新闻内容
	 *
	 * @return
	 */
	@CrossOrigin(origins = "*")
	@PostMapping("getFZDViewDataValue")
	public AjaxJson getFZDViewDataValue(){
		return AjaxJson.success().put("dataTitle",mobileFZDService.getFZDViewDataTitle()).put("dataValue",mobileFZDService.getFZDViewDataValue());
	}

	/**
	 * 获取新闻内容
	 *
	 * @return
	 */
	@CrossOrigin(origins = "*")
	@PostMapping("getFZDViewOne")
	public AjaxJson getFZDViewOne(){
		return AjaxJson.success().put("data",mobileFZDService.getFZDViewOne());
	}

	/**
	 * 获取新闻内容
	 *
	 * @return
	 */
	@CrossOrigin(origins = "*")
	@PostMapping("getFZDViewDataValueOne")
	public AjaxJson getFZDViewDataValueOne(){
		return AjaxJson.success().put("dataTitle",mobileFZDService.getFZDViewDataTitleOne()).put("dataValue",mobileFZDService.getFZDViewDataValueOne());
	}

	/**
	 * 获取新闻内容
	 *
	 * @return
	 */
	@CrossOrigin(origins = "*")
	@PostMapping("getFZDMap")
	public AjaxJson getFZDMap(){
		return AjaxJson.success().put("data",mobileFZDService.getFZDMap());
	}

	/**
	 * 获取新闻内容
	 *
	 * @return
	 */
	@CrossOrigin(origins = "*")
	@GetMapping("getAreaValue")
	public AjaxJson getAreaValue(String address){
		if(!address.equals("成都高新区政务服务中心")){
			return AjaxJson.success().put("data",gxStreetsInfoService.streetsInfo(address));
		}else {
			return AjaxJson.success().put("data",gxStreetsInfoService.gxqInfo(address));
		}

	}

	/**
	 * 获取新闻内容
	 *
	 * @return
	 */
	@CrossOrigin(origins = "*")
	@GetMapping("getFZDArea")
	public AjaxJson getFZDArea(){
		return AjaxJson.success().put("data",mobileFZDService.getFZDArea());
	}

	/**
	 * 获取点站信息
	 *
	 * @return
	 */
	@CrossOrigin(origins = "*")
	@GetMapping("getFZDPowerStation")
	public AjaxJson getFZDPowerStation(){
		return AjaxJson.success().put("data",mobileFZDService.getFZDPowerStation());
	}
}
